ihelpuoo.namespace("ihelpuoo.upload");

ihelpuoo.upload.getFilePathById=function(fId, extension)
{
	var fs = ihelpuoo.fullLeft(fId,"0",8);
	var path = ihelpuoo.upload.getFileHomePath();
	for (var i = 0; i < 8; i += 2)
	{
		path += "/"+fs.substring(i,i + 2);
	}
	if (!ihelpuoo.isBlank(extension))
		path += "." + extension;
	return path;
}

ihelpuoo.upload.File = function(ele)
{
	this.id = 0;
	this.name = null;
	this.extension = null;
	this.path = null;
	this.description = null;
	this.createTime = null;
	this.lastModifiedTime = null;
	this.deleteTime = null;
	if(ele)
		this.valueOf(ele);
}

ihelpuoo.upload.File.prototype
=
{
	valueOf: function(ele)
	{
		this.id = ihelpuoo.xml.getAttributeAsInteger(ele,"id",0);
		this.name = ihelpuoo.xml.getAttribute(ele,"name");
		this.extension = ihelpuoo.xml.getAttribute(ele,"extension");
		this.description = ihelpuoo.xml.getElementText(ele,"description");
		this.createTime = ihelpuoo.xml.getElementText(ele,"create-time");
		this.lastModifiedTime = ihelpuoo.xml.getElementText(ele,"last-modified-time");
		
		this.path = ihelpuoo.upload.getFilePathById(this.id,this.extension);
	}
	
	,
	dump: function()
	{
		return this.path;
	}

}